package exam.wzb.jsp.utils;

import javax.sql.DataSource;
import java.io.InputStream;
import java.util.Properties;

public class DruidUtil {
    private static DataSource dataSource;

    static {
        try {
            Properties props = new Properties();
            InputStream inputStream = DruidUtil.class.getClassLoader().getResourceAsStream("druid.properties");
            props.load(inputStream);

            dataSource = DruidDataSourceFactory.createDataSource(props);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static DataSource getDataSource() {
        return dataSource;
    }
}
